package org.example.design.composite;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.LinkedList;
import java.util.List;

/**
 * @author huangshen
 * @version 0
 * @description File
 * @since 2022/2/8 23:11
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class File extends Entry {

    private String name;

    private int size;

    public File(String name, int size) {
        this.name = name;
        this.size = size;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getSize() {
        return size;
    }

    @Override
    public Entry add(Entry entry) {
        return this;
    }

    @Override
    protected void printList(String prefix) {
        System.out.println(prefix + "/" + name + "(" + size + ")");
    }
}
